import 'package:lepig/common/config/theme.dart';
import 'package:lepig/common/config/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/**
 * 我的收藏
 */
class MyCollection extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _MyCollection();
  }
}

class _MyCollection extends State<MyCollection>
    with SingleTickerProviderStateMixin {
  List<String> Tabs = [
    "今日新增",
    "昨日新增",
    "一级粉丝",
    "二级粉丝",
  ];
  TabController _tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabController = TabController(length: Tabs.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    List<String> items = new List<String>.generate(20, (i) => "Item ${i + 1}");

    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: new Text("我的收藏"),
      ),
      body: new ListView.builder(
        itemCount: items.length,
        itemBuilder: (context, index) {
          final item = items[index];

          return new Dismissible(
            key: new Key(item),
            // We also need to provide a function that will tell our app
            // what to do after an item has been swiped away.
            onDismissed: (direction) {
              items.removeAt(index);
//              Scaffold.of(context).showSnackBar(
//                  new SnackBar(content: new Text("$item dismissed")));
            },
            // Show a red background as the item is swiped away
            background: new Container(
              child: Icon(Icons.delete,color: Colors.white,),
              color: Colors.redAccent,
            ),
            child:  new Padding(
              child:  new Flex(
                direction: Axis.horizontal,
                children: <Widget>[
                  new Container(
                    width: 80.0,
                    margin: EdgeInsets.only(right: 10.0),
                    child: new ClipRRect(
                      borderRadius: BorderRadius.circular(10.0),
                      child: new Image.network("https://img.alicdn.com/bao/uploaded/i1/2206889475556/O1CN01nwgulh1quh7VRxrc0_!!0-item_pic.jpg",width: 50.0,),
                    ),
                  ),
                  new Expanded(
                    child: new Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        new Container(
                          child:   new Text("【天猫旗舰店】儿童夏季防水无袖吃饭罩衫",maxLines: 2,overflow:TextOverflow.ellipsis,style: TextStyle(
                              fontSize: 15.0
                          ),),
                          height: 55.0,
                        ),
                        new Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            new Row(
                              children: <Widget>[
                                new Text("￥",style: TextStyle(
                                    color: Colors.redAccent
                                ),),
                                new Text("58.25",style: TextStyle(
                                    color: Colors.redAccent,
                                    fontSize: 18.0
                                ),)
                              ],
                            ),
                            new Container(
                              padding: EdgeInsets.only(left: 10,right: 10,top: 5,bottom: 5),
                              child: new Text("预计赚：￥1.25",style: TextStyle(
                                color: Colors.white,
                                fontSize: 12.0,
                              ),),
                              color: Colors.redAccent,
                            )
                          ],
                        )
                      ],
                    ),
                  ),

                ],
              ),
              padding: EdgeInsets.all(10.0),
            ),
          );
        },
      ),
    );
  }
}
